/*
 * @Author: your name
 * @Date: 2021-07-08 13:24:22
 * @LastEditTime: 2021-07-13 11:16:15
 * @Description:
 */
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '../layout/index.vue'

export const constantRoutes:Array<RouteRecordRaw> = [
  {
    path: '/login',
    component: () => import(/* webpackChunkName: "login" */ '@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "404" */'@/views/404.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: '/dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index.vue'),
      meta: {
        title: 'Dashboard',
        icon: 'el-icon-menu'
      }
    }]
  },
  {
    path: '/example',
    component: Layout,
    redirect: '/example/table',
    meta: { title: 'Example', icon: 'el-icon-s-help' },
    children: [
      {
        path: '/example/table',
        name: 'Example',
        component: () => import('@/views/table/index.vue'),
        meta: {
          title: 'Example'
        }
      },
      {
        path: '/example/tree',
        name: 'Tree',
        component: () => import('@/views/tree/index.vue'),
        meta: {
          title: 'Tree'
        }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)',
    redirect: '/404',
    meta: {
      hidden: true
    }
  }
]

export const asyncRoutes = []

export default createRouter({
  // 指定路由模式
  history: createWebHashHistory(),
  // 路由地址
  routes: constantRoutes
})
